import { createRouter, createWebHashHistory } from "vue-router";

import Login from "@/view/Login.vue";
import Reset from "@/view/Reset.vue";
import Register from "@/view/Register.vue";
import AdminLayout from "@/view/AdminLayout.vue";
import UserLayout from "@/view/UserLayout.vue";


import CommunicationAdmin from "@/view/admin/CommunicationAdmin.vue";
import HistoryAdmin1 from "@/view/admin/HistoryAdmin1.vue";
import HistoryAdmin2 from "@/view/admin/HistoryAdmin2.vue";
import PersonMessageAdmin1 from "@/view/admin/PersonMessageAdmin1.vue";
import PersonMessageAdmin2 from "@/view/admin/PersonMessageAdmin2.vue";
import UserAdmin1 from "@/view/admin/UserAdmin1.vue";
import UserAdmin2 from "@/view/admin/UserAdmin2.vue";
import CommunicationUser from "@/view/user/CommunicationUser.vue";
import HistoryUser1 from "@/view/user/HistoryUser1.vue";
import HistoryUser2 from "@/view/user/HistoryUser2.vue";
import PersonMessageUser1 from "@/view/user/PersonMessageUser1.vue";
import PersonMessageUser2 from "@/view/user/PersonMessageUser2.vue";

import DashboardsAdmin from "@/view/admin/DashboardsAdmin.vue";
import FunctionAdmin from "@/view/admin/FunctionAdmin1.vue";
import DashboardsUser from "@/view/user/DashboardsUser.vue";
import FunctionUser from "@/view/user/FunctionUser1.vue";
import FunctionAdmin1 from "@/view/admin/FunctionAdmin1.vue";

// 定义路由规则
const routes = [
    {
        path: '/',
        redirect:'/login'

    },

    {
        path: '/login',  //login登录页面
        name: 'Login',
        component: Login
    },
    {
        path: '/reset',  //reset登录页面
        name: 'Reset',
        component: Reset
    },
    {
        path: '/register',  //register登录页面
        name: 'Register',
        component: Register
    },
    {
        path: '/adminLayout',  //adminLayout登录页面
        name: 'AdminLayout',
        component: AdminLayout,
        children: [

            {
                path: 'DashboardsAdmin', // 注意：没有前导斜杠！
                name: 'DashboardsAdmin',
                component: DashboardsAdmin ,
            },
            {
                path: 'FunctionAdmin1', // 注意：没有前导斜杠！
                name: 'FunctionAdmin1',
                component: FunctionAdmin1,
            },

            {
                path: 'CommunicationAdmin', // 注意：没有前导斜杠！
                name: 'CommunicationAdmin',
                component: CommunicationAdmin,
            },
            {
                path: 'HistoryAdmin1', // 注意：没有前导斜杠！
                name: 'HistoryAdmin1',
                component: HistoryAdmin1,
            },
            {
                path: 'HistoryAdmin2', // 注意：没有前导斜杠！
                name: 'HistoryAdmin2',
                component: HistoryAdmin2,
            },
            {
                path: 'PersonMessageAdmin1', // 注意：没有前导斜杠！
                name: 'PersonMessageAdmin1',
                component: PersonMessageAdmin1,
            },
            {
                path: 'PersonMessageAdmin2', // 注意：没有前导斜杠！
                name: 'PersonMessageAdmin2',
                component: PersonMessageAdmin2,
            },
            {
                path: 'UserAdmin1', // 注意：没有前导斜杠！
                name: 'UserAdmin1',
                component: UserAdmin1,
            },
            {
                path: 'UserAdmin2', // 注意：没有前导斜杠！
                name: 'UserAdmin2',
                component: UserAdmin2,
            },
        ]
    },
    {
        path: '/userLayout',  //de登录页面
        name: 'UserLayout',
        component: UserLayout,
        children: [

            {
                path: 'DashboardsUser', // 注意：没有前导斜杠！
                name: 'DashboardsUser',
                component: DashboardsUser,
            },
            {
                path: 'FunctionUser', // 注意：没有前导斜杠！
                name: 'FunctionUser',
                component: FunctionUser,
            },
            {
                path: 'CommunicationUser', // 注意：没有前导斜杠！
                name: 'CommunicationUser',
                component: CommunicationUser,
            },
            {
                path: 'HistoryUser1', // 注意：没有前导斜杠！
                name: 'HistoryUser1',
                component: HistoryUser1,
            },
            {
                path: 'HistoryUser2', // 注意：没有前导斜杠！
                name: 'HistoryUser2',
                component: HistoryUser2,
            },
            {
                path: 'PersonMessageUser1', // 注意：没有前导斜杠！
                name: 'PersonMessageUser1',
                component: PersonMessageUser1,
            },
            {
                path: 'PersonMessageUser2', // 注意：没有前导斜杠！
                name: 'PersonMessageUser2',
                component: PersonMessageUser2,
            }
        ]
    },
];

const router = createRouter({
    // 设置路由模式为 hash 模式
    history: createWebHashHistory(),
    routes  // 简写等同于 routes: routes
});
// 关键点：使用 export default
export default router